<?php

namespace Desktopd\MUA;


// PKCS12 (as a private key store)
class PKCS12 {
    protected $cert;
    protected $key;
    
    public function __construct ($input, $passphrase) {
        $certs = array();
        openssl_pkcs12_read($input, $certs, $passphrase);
        $this->cert = isset($certs['cert']) ? $certs['cert'] : '';
        $this->pkey = isset($certs['pkey']) ? $certs['pkey'] : '';
    }
    
    public function getCert () {
        return $this->cert;
    }
    
    public function getPrivateKey () {
        return $this->pkey;
    }
}


// vim: ts=4 et ai

